use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;

my $sel = Test::WWW::Selenium->new( host => "localhost", 
                                    port => 4444, 
                                    browser => "*firefox", 
                                    browser_url => "http://localhost.com" );

$sel->open_ok("/");
#$sel->click_ok("log_in_top");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_element_present_ok("link=Log out");
$sel->click_ok("link=Administration");
$sel->wait_for_page_to_load_ok("30000");
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok("30000");
$sel->click_ok("link=Add");
$sel->wait_for_page_to_load_ok("30000");
$sel->type_ok("product", "SeleniumTest");
$sel->type_ok("description", "Used by Selenium tests.");
$sel->click_ok("//input[\@value='Add']");
$sel->wait_for_page_to_load_ok("30000");
$sel->click_ok("link=add at least one component");
$sel->wait_for_page_to_load_ok("30000");
$sel->type_ok("component", "SeleniumTest");
$sel->type_ok("description", "Used by Selenium tests.");
$sel->type_ok("initialowner", "TomWij\@live.com");
$sel->click_ok("create");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_text_present_ok("The component SeleniumTest has been created.");
